﻿//
// Created by Arosy on 2021/11/25.
//

//
// Created by Arosy on 2021/11/25.
//




public class BytecodeStream:FileC
{
	private MethodInfo belongMethod;
	private CodeAttributeInfo belongCode;
	private int length;
	private int index;
	private byte[] codes;


	//#pragma comment(lib,"ws2_32.lib")
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 WARNING: 'const' methods are not available in C#:
//ORIGINAL LINE: MethodInfo *getBelongMethod() const
	public MethodInfo getBelongMethod()
	{
		return belongMethod;
	}

	public void setBelongMethod(MethodInfo belongMethod)
	{
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 TODO TASK: C# does not have an equivalent to pointers to variables (in C#, the variable no longer points to the original when the original variable is re-assigned):
//ORIGINAL LINE: BytecodeStream::belongMethod = belongMethod;
		this.belongMethod = belongMethod;
	}

//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 WARNING: 'const' methods are not available in C#:
//ORIGINAL LINE: CodeAttributeInfo *getBelongCode() const
	public CodeAttributeInfo getBelongCode()
	{
		return belongCode;
	}

	public void setBelongCode(CodeAttributeInfo belongCode)
	{
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 TODO TASK: C# does not have an equivalent to pointers to variables (in C#, the variable no longer points to the original when the original variable is re-assigned):
//ORIGINAL LINE: BytecodeStream::belongCode = belongCode;
		this.belongCode = belongCode;
	}

//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 WARNING: 'const' methods are not available in C#:
//ORIGINAL LINE: int getLength() const
	public int getLength()
	{
		return length;
	}

	public void setLength(int length)
	{
		this.length = length;
	}

//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 WARNING: 'const' methods are not available in C#:
//ORIGINAL LINE: int getIndex() const
	public int getIndex()
	{
		return index;
	}

	public void setIndex(int index)
	{
		this.index = index;
	}

//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 WARNING: 'const' methods are not available in C#:
//ORIGINAL LINE: sbyte *getCodes() const
	public byte[] getCodes()
	{
		return codes;
	}

	public void setCodes( byte[] codes)
	{
		this.codes = codes;
	}

	public BytecodeStream(MethodInfo belongMethod, CodeAttributeInfo belongCode, int length, int index, byte[] codes)
	{
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 TODO TASK: C# does not have an equivalent to pointers to variables (in C#, the variable no longer points to the original when the original variable is re-assigned):
//ORIGINAL LINE: this.belongMethod = belongMethod;
		this.belongMethod = belongMethod;
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 TODO TASK: C# does not have an equivalent to pointers to variables (in C#, the variable no longer points to the original when the original variable is re-assigned):
//ORIGINAL LINE: this.belongCode = belongCode;
		this.belongCode = belongCode;
		this.length = length;
		this.index = index;
		this.codes = codes;

	}

	public BytecodeStream()
	{
	}

	public byte readByOne(ref int offset)
	{
		return (byte)(codes[offset++]);
	}

	public ushort readByTwo(ref int offset)
	{
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 TODO TASK: C# does not have an equivalent to pointers to value types:
//ORIGINAL LINE: ushort *res = (ushort *)(codes + offset);
		ushort res = (ushort)(codes[offset]);
		offset += 2;
		return htons(res);
	}
}

